<template>
  <el-container>
    <el-main>
      <el-form label-position="top">
        <el-row :gutter="15">
          <!-- 分割线----1、基本信息-->
          <el-col :span="24">
            <MyDivider label="1、基本信息"></MyDivider>
          </el-col>
          <!-- 招标基本信息(项目名称) -->
          <el-col :span="24">
            <el-col :span="12">
              <el-form-item label="招投标需求选择">
                <el-button
                  plain
                  icon="el-icon-s-management"
                  class="bt_user"
                  @click="handleAdd"
                  >选择数据</el-button
                >
              </el-form-item>
              <el-form-item label="招投标需求编号" class="dan">
                <el-input
                  :disabled="true"
                  v-model="form.demandNumber"
                  placeholder="暂无内容"
                ></el-input>
              </el-form-item>
              <el-form-item label="招投标明细" class="dan">
                <el-table
                  :data="mxList"
                  :row-class-name="rowPcmEvaluationRuleIndex"
                  border
                >
                  <el-table-column
                    fixed="left"
                    align="center"
                    prop="index"
                    width="78"
                  />
                  <el-table-column
                    label="采购申请编号"
                    width="180"
                    align="center"
                    prop="purchaseRequestNumber"
                  />
                  <el-table-column
                    label="行号"
                    align="center"
                    width="162"
                    prop="demandLineNumber"
                  />
                  <el-table-column label="采购类型" width="160" align="center">
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.sys_type_purchase"
                        :value="scope.row.typePurchase"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="产品编号"
                    width="180"
                    align="center"
                    prop="pcmMaterialRecord.productNumber"
                  />
                  <el-table-column
                    label="产品名称"
                    width="150"
                    align="center"
                    prop="pcmMaterialRecord.productName"
                  />
                  <el-table-column label="单位" align="center">
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.sys_unit"
                        :value="scope.row.pcmMaterialRecord.unit"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="需求数量"
                    width="120"
                    align="center"
                    prop="requiredQuantity"
                  />
                  <el-table-column
                    label="期望到货时间"
                    width="120"
                    align="center"
                    prop="expectedDeliveryDate"
                  />
                  <el-table-column
                    label="期望供应商"
                    width="150"
                    align="center"
                    prop="expectedSupplierName"
                  />
                  <el-table-column
                    label="申请日期"
                    width="120"
                    align="center"
                    prop="applicationDate"
                  />
                  <el-table-column
                    label="申请人"
                    width="120"
                    align="center"
                    prop="personName"
                  />
                  <el-table-column
                    label="申请部门"
                    width="150"
                    align="center"
                    prop="deptName"
                  />
                </el-table>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="项目名称">
                <el-input class="lala" v-model="form.projectName" />
              </el-form-item>
            </el-col>
          </el-col>
          <!-- 招标基本信息(供应商资格要求|保证金)-->
          <el-col :span="24">
            <el-col :span="12">
              <el-form-item label="供应商资格要求">
                <el-input
                  type="textarea"
                  v-model="form.supplierQualificationRequirements"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="保证金">
                <el-input v-model="form.deposit" class="lala"></el-input>
              </el-form-item>
            </el-col>
          </el-col>
          <!-- 招标基本信息(采购负责人|采购联系电话) -->
          <el-col :span="24">
            <el-col :span="12">
              <el-form-item label="采购负责人">
                <el-select
                  v-model="form.procurementManager"
                  class="lala"
                  filterable
                  clearable
                  placeholder="选择成员"
                >
                  <el-option
                    v-for="item in procurements"
                    :key="item.userId"
                    :label="item.nickName"
                    :value="item.userId"
                  >
                    <span style="float: left">{{ item.nickName }}</span>
                    <span
                      style="float: right; color: #8492a6; font-size: 13px"
                      >{{ item.deptName }}</span
                    >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="采购联系电话">
                <el-input
                  class="lala"
                  v-model="form.procurementContactNumber"
                />
              </el-form-item>
            </el-col>
          </el-col>
          <!-- 分割线---2、招标计划-->
          <el-col :span="24">
            <MyDivider label="2、招标计划"></MyDivider>
          </el-col>
          <!-- 时间空间集合(开始并截止时间) -->
          <el-col :span="24">
            <el-col :span="12">
              <el-form-item label="报名截止时间">
                <el-date-picker
                  type="datetime"
                  v-model="form.registrationDeadline"
                  placeholder="选择日期时间"
                  :default-time="getDefaultTime()"
                />
              </el-form-item>
              <el-form-item label="投标结束时间">
                <el-date-picker
                  type="datetime"
                  v-model="form.biddingEndTime"
                  placeholder="选择日期时间"
                  :default-time="getDefaultTime()"
                />
              </el-form-item>
              <el-form-item label="计划开标时间">
                <el-date-picker
                  type="datetime"
                  v-model="form.plannedBidOpeningTime"
                  placeholder="选择日期时间"
                  :default-time="getDefaultTime()"
                />
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="投标开始时间">
                <el-date-picker
                  type="datetime"
                  v-model="form.biddingStartTime"
                  placeholder="选择日期时间"
                  :default-time="getDefaultTime()"
                />
              </el-form-item>
              <el-form-item label="评标截止时间">
                <el-date-picker
                  type="datetime"
                  v-model="form.evaluationDeadline"
                  placeholder="选择日期时间"
                  :default-time="getDefaultTime()"
                />
              </el-form-item>
            </el-col>
          </el-col>
          <!-- 分割线---3、邀标供应商-->
          <el-col :span="24">
            <MyDivider label="3、邀标供应商"></MyDivider>
          </el-col>
          <!-- 供应商表格(供应商总数) -->
          <el-col :span="24">
            <el-col :span="13">
              <el-form-item label="选择要邀请的供应商">
                <span style="color: #838892; font-size: 12px"
                  >只能邀请成功互联的供应商，1次操作不能超过200个供应商</span
                >
                <el-table
                  :data="gysList"
                  :row-class-name="rowPcmEvaluationRuleIndex"
                  border
                  @cell-mouse-enter="handleCellMouseEnter"
                  @cell-mouse-leave="handleCellMouseLeave"
                >
                  <el-table-column
                    fixed="left"
                    align="center"
                    prop="index"
                    width="70"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        v-if="hoveredIndex !== scope.row.index"
                      >
                        {{ scope.row.index }}
                      </el-button>
                      <el-button
                        v-else
                        size="mini"
                        type="text"
                        icon="el-icon-delete"
                        @click="handleDelete(scope.row)"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="供应商状态"
                    width="198"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.pcm_supplier_states"
                        :value="scope.row.supplierStates"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="供应商全称"
                    prop="supplierFullName"
                    width="203"
                    align="center"
                  />
                  <el-table-column
                    label="供应产品类别"
                    width="198"
                    align="center"
                  >
                    <template slot-scope="scope">
                      <dict-tag
                        :options="dict.type.sys_sup_cat"
                        :value="scope.row.supplyProductCategory"
                      />
                    </template>
                  </el-table-column>
                </el-table>
                <el-button
                  icon="el-icon-plus"
                  id="addyang"
                  type="success"
                  @click="openSupplier"
                  plain
                  round
                  >添加</el-button
                >
              </el-form-item>
              <el-form-item label="参与招投标供应商总数">
                <el-input
                  :disabled="true"
                  placeholder="暂无内容"
                  style="width: 572px"
                  v-model="sumGys"
                />
              </el-form-item>
            </el-col>
          </el-col>
          <!-- 分割线--4、标书--->
          <el-col :span="24">
            <MyDivider label="4、标书"></MyDivider>
          </el-col>
          <!-- 标书&&评标下拉框&&评标表格 -->
          <el-col :span="24">
            <el-col :span="12">
              <el-form-item label="标书">
                <el-upload
                  drag
                  class="upload-demo"
                  :action="baseApi + '/file/uploadMinio'"
                  :headers="token"
                  :on-remove="handleRemove"
                  :on-success="handleSuccess"
                  list-type="picture"
                  multiple
                  ref="uploadBidDocs"
                >
                  <el-button size="medium" type="text" style="color: #00b899"
                    >选择</el-button
                  >
                  <span style="color: #b5b8be; margin-left: 10px"
                    >拖拽或粘贴文件，单个20MB以内</span
                  >
                </el-upload>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="评标规则">
                <el-select
                  v-model="form.evaluationRuleID"
                  @change="getByTliList"
                  @clear="handleClear"
                  class="lala"
                  filterable
                  clearable
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in criteriaList"
                    :key="item.evaluationCriteriaId"
                    :label="item.criteriaName"
                    :value="item.evaluationCriteriaId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="14" style="padding: 0">
              <el-form-item label="评标规则" class="guize">
                <el-table
                  :data="criteriaZiList"
                  :row-class-name="rowPcmEvaluationRuleIndex"
                  border
                >
                  <el-table-column
                    fixed="left"
                    align="center"
                    prop="index"
                    width="70"
                  />
                  <el-table-column
                    label="评估项"
                    prop="evaluationItem"
                    width="222"
                    align="left"
                  />
                  <el-table-column
                    label="评分详情及标准"
                    prop="scoreDetailsAndStandards"
                    align="left"
                    width="235"
                  />
                  <el-table-column
                    label="最高分"
                    prop="maximumScore"
                    width="210"
                    align="left"
                  />
                </el-table>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="满分">
                <el-input
                  :disabled="true"
                  v-model="sumMaximumScore"
                  placeholder="暂无内容"
                />
              </el-form-item>
            </el-col>
          </el-col>
          <!-- 分割线--5、评标专家--->
          <el-col :span="24">
            <MyDivider label="5、评标专家"></MyDivider>
          </el-col>
          <!-- 评标专家表格 --->
          <el-col :span="24" style="margin-bottom: 80px">
            <el-col :span="9" style="padding: 0">
              <el-form-item label="专家明细" class="zjia">
                <el-table
                  :data="expertList"
                  :row-class-name="rowPcmEvaluationRuleIndex"
                  border
                  @cell-mouse-enter="handleCellMouseEnter"
                  @cell-mouse-leave="handleCellMouseLeave"
                >
                  <el-table-column
                    fixed="left"
                    align="center"
                    prop="index"
                    width="70"
                  >
                    <template slot-scope="scope">
                      <el-button
                        size="mini"
                        type="text"
                        v-if="hoveredIndex !== scope.row.index"
                      >
                        {{ scope.row.index }}
                      </el-button>
                      <el-button
                        v-else
                        size="mini"
                        type="text"
                        icon="el-icon-delete"
                        @click="handleExpertDelete(scope.row)"
                      />
                    </template>
                  </el-table-column>
                  <el-table-column label="专家" width="190" align="center">
                    <template slot-scope="scope">
                      <el-input
                        placeholder="专家成员名称"
                        :readonly="true"
                        v-model="scope.row.nickName"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column label="联系电话" align="center" width="213">
                    <template slot-scope="scope">
                      <el-input v-model="scope.row.phone"></el-input>
                    </template>
                  </el-table-column>
                </el-table>
                <el-button
                  icon="el-icon-plus"
                  id="addyang"
                  type="success"
                  plain
                  round
                  @click="openExpert"
                  >添加</el-button
                >
              </el-form-item>
            </el-col>
          </el-col>
        </el-row>
      </el-form>
    </el-main>
    <el-footer>
      <el-button type="success" @click="addZb">提交</el-button>
      <el-button @click="rmclose">取消</el-button>
    </el-footer>

    <!-- 申请明细对话框 -->
    <el-dialog
      :title="textdetail"
      :visible.sync="applicationdetail"
      width="888px"
    >
      <el-form
        :model="detaiList"
        ref="queryFormDetail"
        size="small"
        :inline="true"
        v-show="showSearch"
      >
        <el-form-item label="招标需求编号">
          <el-input
            v-model="detaiList.demandNumber"
            placeholder="请输入招标需求编号"
            clearable
            @keydown.enter.native.prevent="handleQueryDetail"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQueryDetail"
            >搜索</el-button
          >
          <el-button
            icon="el-icon-refresh"
            size="mini"
            @click="resetQueryDetail"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <div class="balademandList">
        <el-table
          v-loading="appDetail"
          :data="tableData"
          highlight-current-row
          @row-click="handleSelectionChange"
          @row-dblclick="handleSelectiondblClick"
          border
          style="width: 100%"
          max-height="360"
        >
          <el-table-column width="58" align="center" fixed="left">
            <template slot-scope="scope">
              <el-radio
                :label="scope.row.projectID"
                v-model="projectID"
              ></el-radio>
            </template>
          </el-table-column>
          <el-table-column
            label="招投标需求编号"
            prop="demandNumber"
            width="150"
            align="center"
          />
          <el-table-column label="招投标明细" align="center">
            <el-table-column label="采购申请编号" align="center" width="180">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.purchaseRequestNumber }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="行号" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.demandLineNumber }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="采购类型" width="120" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  <dict-tag
                    :options="dict.type.sys_type_purchase"
                    :value="value.typePurchase"
                  />
                </div>
              </template>
            </el-table-column>
            <el-table-column label="产品编号" width="180" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.pcmMaterialRecord.productNumber }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="产品名称" width="120" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.pcmMaterialRecord.productName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="单位" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  <dict-tag
                    :options="dict.type.sys_unit"
                    :value="value.pcmMaterialRecord.unit"
                  />
                </div>
              </template>
            </el-table-column>
            <el-table-column label="需求数量" align="center" width="80">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.requiredQuantity }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="期望到货时间" width="120" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.expectedDeliveryDate }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="期望供应商" width="150" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.expectedSupplierName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请日期" width="120" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.applicationDate }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请人" width="100" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.personName }}
                </div>
              </template>
            </el-table-column>
            <el-table-column label="申请部门" width="120" align="center">
              <template slot-scope="scope">
                <div
                  v-for="value in scope.row.pcmApplicationDetailList"
                  :key="value.detailId"
                >
                  {{ value.deptName }}
                </div>
              </template>
            </el-table-column>
          </el-table-column>
        </el-table>
      </div>
      <pagination
        v-show="tableDataTotal > 0"
        :total="tableDataTotal"
        :page.sync="detaiList.pageNum"
        :limit.sync="detaiList.pageSize"
        @pagination="handleQuery"
      />
    </el-dialog>

    <!-- 供应商数据 -->
    <el-dialog
      :title="textdetail"
      :visible.sync="supplieroverlay"
      width="800px"
    >
      <el-form
        :model="supplierWhere"
        ref="queryFormSupplier"
        size="small"
        :inline="true"
      >
        <el-form-item label="供应商名称">
          <el-input
            v-model="supplierWhere.supplierFullName"
            placeholder="请输入供应商名称"
            clearable
            @keydown.enter.native.prevent="handleQuerySupplier"
          />
        </el-form-item>
        <el-form-item label="供应商状态">
          <el-select
            v-model="supplierWhere.supplierStates"
            placeholder="请选择供应商状态"
          >
            <el-option
              v-for="item in filteredStates"
              :key="item.value"
              :label="item.label"
              :value="item.value"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQuerySupplier"
            >搜索</el-button
          >
          <el-button
            icon="el-icon-refresh"
            size="mini"
            @click="resetQuerySupplier"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <div class="supplierTableCss">
        <el-table
          v-loading="supplierTx"
          ref="multipleTable"
          :data="supplierList"
          @selection-change="SupplierSelectionChange"
          border
          style="width: 100%"
          max-height="360"
        >
          <el-table-column
            width="58"
            type="selection"
            align="center"
            fixed="left"
          />
          <el-table-column label="供应商状态" width="150" align="left">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.pcm_supplier_states"
                :value="scope.row.supplierStates"
              />
            </template>
          </el-table-column>
          <el-table-column
            label="供应商全称"
            prop="supplierFullName"
            width="150"
            align="left"
          />
          <el-table-column label="供应产品类别" width="150" align="left">
            <template slot-scope="scope">
              <dict-tag
                :options="dict.type.sys_sup_cat"
                :value="scope.row.supplyProductCategory"
              />
            </template>
          </el-table-column>
          <el-table-column width="251" />
        </el-table>
      </div>
      <pagination
        v-show="supplierNum > 0"
        :total="supplierNum"
        :page.sync="supplierWhere.pageNum"
        :limit.sync="supplierWhere.pageSize"
        @pagination="getSupplierMx"
      />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="qdGys">确 定</el-button>
        <el-button>取 消</el-button>
      </div>
    </el-dialog>

    <!-- 专家数据 -->
    <el-dialog
      :title="textdetail"
      :visible.sync="expertUseroverlay"
      width="600px"
    >
      <el-form
        :model="expertWhere"
        ref="queryFormSupplier"
        size="small"
        :inline="true"
      >
        <el-form-item label="专家名称">
          <el-input
            v-model="expertWhere.nickName"
            placeholder="请输入专家名称"
            clearable
            @keydown.enter.native.prevent="handleQueryExpert"
          />
        </el-form-item>
        <el-form-item>
          <el-button
            type="primary"
            icon="el-icon-search"
            size="mini"
            @click="handleQueryExpert"
            >搜索</el-button
          >
          <el-button
            icon="el-icon-refresh"
            size="mini"
            @click="resetQueryExpert"
            >重置</el-button
          >
        </el-form-item>
      </el-form>
      <div class="supplierTableCss">
        <el-table
          v-loading="expertTx"
          ref="expertTable"
          :data="zjList"
          @selection-change="expertSelectionChange"
          border
          style="width: 100%"
          max-height="360"
        >
          <el-table-column
            width="58"
            type="selection"
            align="center"
            fixed="left"
          />
          <el-table-column
            label="专家名称"
            prop="nickName"
            width="150"
            align="left"
          />
          <el-table-column
            label="公司名称"
            prop="deptName"
            width="150"
            align="left"
          />
          <el-table-column width="200" />
        </el-table>
      </div>
      <pagination
        v-show="expertNum > 0"
        :total="expertNum"
        :page.sync="expertWhere.pageNum"
        :limit.sync="expertWhere.pageSize"
        @pagination="getExpertMx"
      />
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="qdZj">确 定</el-button>
        <el-button>取 消</el-button>
      </div>
    </el-dialog>
  </el-container>
</template>

<script>
import MyDivider from "@/components/bidding/fgx.vue"; // 引入组件
import { listdemand } from "@/api/bidding/demand";
import { listCriteria } from "@/api/bidding/criteria";
import { showByRuoYiUser, showByExpertUser } from "@/api/bidding/sysuser";
import { showAllSupplier } from "@/api/bidding/suppliermx";
import { getToken } from "@/utils/auth.js";
import { addBiddingMiddle } from "@/api/bidding/Inviting";
import dict from "@/utils/dict";
export default {
  components: {
    MyDivider, // 注册组件
  },
  props: [],
  dicts: [
    "pcm_supplier_states",
    "sys_type_purchase",
    "demand_line_status",
    "sys_unit",
    "sys_sup_cat",
  ],
  data() {
    return {
      baseApi: process.env.VUE_APP_BASE_API,
      //招标明细遮盖层
      applicationdetail: false,
      //供应商明细遮盖层
      supplieroverlay: false,
      //供应商全部数据
      supplierList: [],
      //供应商集合条数
      supplierNum: 0,
      //供应商表格加载特效
      supplierTx: true,
      //专家表格加载特效
      expertTx: true,
      //专家明细遮盖层
      expertUseroverlay: false,
      //招标需求表格加载特效
      appDetail: true,
      //招标明细条数
      tableDataTotal: 0,
      //招标明细数据
      tableData: [],
      // 显示搜索条件
      showSearch: true,
      //招标明细条件
      detaiList: {
        pageNum: 1,
        pageSize: 5,
        demandNumber: "",
      },
      //供应商明细条件
      supplierWhere: {
        pageNum: 1,
        pageSize: 5,
        supplierFullName: "",
      },

      //专家明细条件
      expertWhere: {
        pageNum: 1,
        pageSize: 5,
        nickName: "",
      },
      //专家集合条数
      expertNum: 0,
      //评标专家全部数据
      expertList: [],
      //招标明细选中的ID
      projectID: 0,
      //选中的招标数据
      mxList: [],
      //评标规则数据
      criteriaList: [],
      //选择的规则详细数据
      criteriaZiList: [],
      //采购负责人数据
      procurements: [],
      //增加表单数据
      form: {
        fileList: [],
      },
      formData: {
        field103: undefined,
      },
      xj: [],
      values3: "",
      hoveredIndex: -1,
      textdetail: "选择数据",
      //邀标供应商数据
      gysList: [],
      //备选供应商
      bxgysList: [],
      //备选专家
      bxzjList: [],
      zjList: [],
    };
  },
  computed: {
    token() {
      return {
        Authorization: `Bearer ${getToken()}`,
      };
    },
    sumMaximumScore() {
      let sumMax = 0;
      this.criteriaZiList.map((item) => (sumMax += item.maximumScore));
      if (sumMax == 0) {
        return null;
      }
      return sumMax;
    },
    filteredStates() {
      return this.dict.type.pcm_supplier_states.filter(
        (item) => item.value != 4
      );
    },
    sumGys() {
      if (
        this.gysList.length <= 0 ||
        this.gysList[0].supplierFullName == "暂无内容"
      ) {
        return null;
      }
      return this.gysList.length;
    },
  },
  watch: {},
  created() {
    this.getCriteriaList();
    showByRuoYiUser().then((response) => (this.procurements = response.rows));
    var obj = {
      supplierStates: "暂无内容",
      supplierFullName: "暂无内容",
      supplyProductCategory: "暂无内容",
    };
    this.gysList.push(obj);

    this.expertList.push({});
    this.form.fileList=[];
  },
  mounted() {
  },
  methods: {
    addZb() {
      this.form.gysList = this.gysList.map((item) => item.supplierID2);
      this.form.expertList = this.expertList.map((item) => {
        let obj = {};
        obj.userId = item.userId;
        obj.phone = item.phone;
        return obj;
      });
      console.log("this.form", this.form);
      addBiddingMiddle(this.form).then((response) => {
        this.$modal.msgSuccess("新增成功");
        this.$tab.closeOpenPage({ path: "/bidding/Inviting" });
      });
    },
    rmclose() {
      this.$tab.closeOpenPage({ path: "/bidding/Inviting" });
    },

    qdGys() {
      this.gysList = this.bxgysList;
      this.supplieroverlay = false;
    },
    qdZj() {
      this.expertList = this.bxzjList;
      this.expertUseroverlay = false;
    },
    openSupplier() {
      this.supplieroverlay = true;
      this.handleQuerySupplier();
    },
    openExpert() {
      this.expertUseroverlay = true;
      this.handleQueryExpert();
    },
    getSupplierMx() {
      this.supplierTx = true;
      showAllSupplier(this.supplierWhere).then((response) => {
        this.supplierList = response.rows;
        this.supplierNum = response.total;
        this.$nextTick(() => {
          for (var i = 0; i < this.supplierList.length; i++) {
            this.gysList.forEach((data) => {
              if (data.supplierID2 == this.supplierList[i].supplierID2) {
                this.$refs.multipleTable.toggleRowSelection(
                  this.supplierList[i],
                  true
                );
              }
            });
          }
        });

        this.supplierTx = false;
      });
    },

    getExpertMx() {
      this.expertTx = true;
      showByExpertUser(this.expertWhere).then((response) => {
        this.zjList = response.rows;
        this.expertNum = response.total;
        this.$nextTick(() => {
          this.zjList.map((item) => {
            this.expertList.forEach((data) => {
              if (data.userId == item.userId) {
                this.$refs.expertTable.toggleRowSelection(item, true);
              }
            });
          });
        });
        this.expertTx = false;
      });
    },
    handleQueryExpert() {
      this.expertWhere.pageNum = 1;
      this.getExpertMx();
    },
    resetQueryExpert() {
      this.expertWhere.nickName = null;
      this.handleQueryExpert();
    },

    handleQuerySupplier() {
      this.supplierWhere.pageNum = 1;
      this.getSupplierMx();
    },
    resetQuerySupplier() {
      this.supplierWhere.supplierFullName = null;
      this.supplierWhere.supplierStates = null;
      this.handleQuerySupplier();
    },
    //供应商多选
    SupplierSelectionChange(selection) {
      this.bxgysList = selection;
    },
    //专家多选
    expertSelectionChange(selection) {
      this.bxzjList = selection;
    },
    /** 查询评标条例列表 */
    getCriteriaList() {
      listCriteria(null).then((response) => {
        this.criteriaList = response.rows;
      });
    },
    // 根据下拉框选中的父级条例查询当前的条例的子集信息
    getByTliList() {
      const list = this.criteriaList.filter(
        (item) => item.evaluationCriteriaId == this.form.evaluationRuleID
      );
      if (list.length > 0) {
        this.criteriaZiList = list[0].pcmEvaluationRuleList;
      }
    },
    handleClear() {
      this.getCriteriaList();
      this.criteriaZiList = [];
    },
    //查询招标明细
    handleQueryDetail() {
      this.detaiList.pageNum = 1;
      this.handleQuery();
    },
    handleQuery() {
      this.appDetail = true;
        listdemand(this.detaiList).then((response) => {
          this.tableData = response.rows;
          this.tableDataTotal = response.total;
          this.appDetail = false;
        });
    },
    // 招标明细单选框选中数据
    handleSelectionChange(selection) {
      this.projectID = selection.projectID;
    },
    handleSelectiondblClick(selection) {
      this.applicationdetail = false;
      this.mxList = selection.pcmApplicationDetailList;
      this.form.demandNumber = selection.demandNumber;
      this.form.projectID = selection.projectID;
    },
    //招标明细重置
    resetQueryDetail() {
      (this.detaiList.demandNumber = null), this.handleQueryDetail();
    },
    handleAdd() {
      this.applicationdetail = true;
      this.handleQueryDetail();
    },
    /** 评标规则序号 */
    rowPcmEvaluationRuleIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    getDefaultTime() {
      const now = new Date();
      const hours = now.getHours().toString().padStart(2, "0");
      const minutes = now.getMinutes().toString().padStart(2, "0");
      const seconds = now.getSeconds().toString().padStart(2, "0");
      return `${hours}:${minutes}:${seconds}`;
    },
    handleDelete(row) {
      this.gysList.splice(row.index - 1, 1);
    },
    handleExpertDelete(row) {
      this.expertList.splice(row.index - 1, 1);
    },
    handleCellMouseEnter(row, column, cell, event) {
      this.hoveredIndex = row.index;
    },
    handleCellMouseLeave(row, column, cell, event) {
      this.hoveredIndex = -1;
    },
    handleRemove(file, fileList) {
      this.form.fileList = this.form.fileList.filter(
        (item) => item.name != file.response.data.name
      );
    },
    handleSuccess(response, file, fileList) {
      console.log("response", response);
      let obj = {};
      obj.attachmentName = decodeURIComponent(response.data.name);
      obj.attachmentAddress = response.data.url.substring(0, response.data.url.lastIndexOf("/") + 1);
      console.log(obj);
      this.form.fileList.push(obj);
    },
  },
};
</script>

<style scoped>
.supplierTableCss >>> .el-table--medium .el-table__cell {
  padding: 4px 8px 4px 10px;
}
::v-deep .el-table--border .el-table__cell:first-child .cell {
  padding-left: 0;
}
.supplierTableCss >>> .el-table th.el-table__cell > .cell {
  padding-right: 0;
}
.el-form--inline >>> .el-form-item {
  margin-right: 7px;
}
::v-deep .balademandList .cell div {
  padding: 2px 0;
  border-bottom: 1px solid #dfe6ec;
  height: 55px;
  overflow: hidden;
  display: flex;
  align-items: center; /* 将项目在交叉轴上居中对齐 */
  justify-content: center; /* 将项目在主轴上居中对齐（水平居中） */
}
::v-deep .cell div:nth-last-child(1) {
  border-bottom: 0px;
  padding: 4px 0px 0px 0px;
}
::v-deep .cell {
  padding: 0px;
}
::v-deep .el-dialog__body {
  border-bottom: 1px solid #ebecee;
}

::v-deep .el-table--medium .el-table__cell {
  padding: 4px 0px;
}
::v-deep .el-radio__label {
  display: none;
}
.guize >>> .el-table--medium .el-table__cell {
  padding: 6px 14px 6px 6px;
}
.zjia >>> .el-table--medium .el-table__cell {
  padding: 2px 4px 4px;
}
::v-deep .el-table th.el-table__cell > .cell {
  padding-left: 4px;
}
::v-deep .el-upload-dragger {
  width: 354px;
  height: 38px;
  text-align: left;
  padding-left: 30px;
  border-radius: 2px;
}
::v-deep .el-upload-list {
  margin-top: -16px;
}
/* ::v-deep .el-upload-list--picture .el-upload-list__item-thumbnail {
  width: 38px;
  height: 38px;
} */
::v-deep .el-upload-list--picture .el-upload-list__item {
  height: 52px;
  border-radius: 4px;
  padding: 6px 10px 10px 88px;
  background-color: #f5f6f8;
}
::v-deep .el-upload-list--picture .el-upload-list__item-name{
  margin-top: 6px;
  margin-left: -24px;
}
::v-deep .el-upload-list--picture .el-upload-list__item-name i{
  font-size: 40px;
  margin-top: -4px;
}
#addyang {
  margin: 10px 0 20px 0;
}
.el-container >>> {
  background-color: #f5f6f8;
  padding: 12px 12px 0;
}
::v-deep .el-button--text {
  color: black;
}
::v-deep .el-date-editor.el-input {
  width: 408px;
}
::v-deep .el-textarea__inner {
  height: 150px !important;
  height: 40px;
}
.el-main >>> {
  background-color: white;
}
.el-container.is-vertical >>> {
  background-color: #f5f6f8;
  padding: 10px 10px 0 16px;
}
.el-footer >>> {
  border-top: 1px dashed #e1e3e5;
  width: 100%;
  position: fixed;
  z-index: 1000;
  bottom: 0px;
  padding-top: 10px;
  background-color: white;
}
.el-footer .el-button--medium >>> {
  width: 128px;
  height: 32px;
}
.el-form--label-top >>> .el-form-item__label {
  padding: 0;
  color: #141e31;
  font-weight: 600;
}
.el-input.is-disabled >>> .el-input__inner {
  border: 0;
  cursor: default;
}
.el-col-12 >>> {
  padding: 7px 52px 12px 0 !important;
}
.el-form-item >>> {
  margin-bottom: 10px;
}
.dan >>> .el-form-item__label {
  color: #141e31;
  font-weight: 400;
}
::v-deep .el-table__empty-block {
  /* display: none !important; */
  height: 1px !important;
  min-height: 0 !important;
}
.el-table >>> thead >>> th {
  padding: 0 !important;
}

::v-deep .el-upload-list--picture .el-upload-list__item-thumbnail {
  position: relative;
}
::v-deep .el-upload-list--picture .el-upload-list__item-thumbnail::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('http://8.130.88.144:9000/xinghai/lala.jpg');
  background-size: cover;
  /* 其他样式，根据需要自行调整 */
}

::v-deep .el-upload-list--picture .el-upload-list__item-thumbnail{
  width: 40px;
  height: 40px;
}

::v-deep .el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name{
  margin-left: -20px;
  line-height:44px;
  padding-left:0px;
}
</style>

<style>
.bt_user {
  width: 408px;
}
.lala {
  width: 408px;
}
</style>
